home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6171 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.5 KB

  1. Path: god.bel.alcatel.be!nlev00!barnhoorn
  2. From: barnhoorn@nlev00 ()
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Removing Processes
  5. Date: 25 Mar 1996 12:07:03 GMT
  6. Organization: Alcatel Bell
  7. Distribution: world
  8. Message-ID: <4j6297$efa@btmpjg.god.bel.alcatel.be>
  9. References: <84215-826944629@mindlink.bc.ca> <314E576C.4E36@sapiens.com>
  10. Reply-To: barnhoorn@nlev00 ()
  11. NNTP-Posting-Host: 138.203.178.61
  12. X-Newsreader: mxrn 6.18-10
  13.  
  14.  
  15. In article <314E576C.4E36@sapiens.com>, Avi Lev <avil@sapiens.com> writes:
  16. >Dave Thomas wrote:
  17. >> 
  18. >> Hi!  I'm writing a program which spawns a sub-process to do another task
  19. >> while the main program handles input.  The problem I'm finding is that the
  20. >> sub-process doesn't exit reliably.  Sometimes it appears to exit, and
  21. >> sometimes not.  Currently, I am allowing the subprocess to run to the end,
  22. >> when (I assume) it does an "RTS" and returns to the OS for removal. Should
  23. >> I be using "RemTask()" to remove the sub-process?  And, if so, should it be
  24. >> called from the sub-process, or from the main program?  BTW, the
  25. >> sub-process is a procedure in the program, and uses some global variables
  26. >> and string constants.
  27. >
  28. >NO!!! RemTask() removes tasks not processes. how do you know if the sub-process actually finished, it 
  29. >might be suspended cuz of higher priority process. i think there's a wait() function which checks to 
  30. >see if the process finished and if not it waits until it does, you might want to go in that direction 
  31. >first. what you're describing sounds like it's a task NOT a real AmigaDos process cuz the 'process' 
  32. >sits in your own program, if that's the case then it's a task not a process and then you can use 
  33. >RemTask() from the creator of the task.
  34.  
  35. ## AAAHHH wrong wrong wrong wrong.
  36. You may either run parts of your application as a process or as a task.
  37. For running a part of your application as a process, use CreateNewProc().
  38. For running a part of your application as a task, use CreateTask().
  39. I suggest you always use CreateNewProc().
  40. When you use one of the two mentioned functions, your subtask or process
  41. will exit reliably - if they don't, you probably have a bug in your code.
  42. You should not exit the main process as long as one of your subprocesses
  43. or tasks are running (obviously...).
  44. You may only remove subtasks (or processes?) as long as it is not
  45. calling any amiga-library-function (because these might be sending messages,
  46. waiting for signals, using other stacks, etcetera).
  47. There is no Wait() function with which you can wait for a process or task
  48. to complete.
  49.  
  50. >> 
  51. >> Next question: I am using a process because I am writing a NNTP news reader
  52. >> program, and I want the sub-process to do the communication across the 'net
  53. >> (using AmiTCP).  It's not clear to me that a task would be sufficient to do
  54. >> this.  Would it be?
  55. >> 
  56. >
  57. >Again NO!!! Tasks are very limited in their capabilities, they can't use DOS services i believe, but 
  58. >if you're not using any i guess a task would suffice.
  59. >
  60.  
  61. ## That is true, tasks can not use in any way the dos.library, nor can they
  62. call any amiga-library-function that might call dos.library (e.g. OpenDiskFont).
  63. Therefor, I suggest you to create a process always, using CreateNewProc().
  64.  
  65.  
  66. -- 
  67. ---------------------------------------------------------------------------
  68. Jaco Barnhoorn               barnie@xs4all.nl
  69. Software Test Engineer       barnhoorn%nlev00@btmv56.se.bel.alcatel.be
  70. Alcatel Telecom Systems
  71. Rijswijk, The Netherlands
  72. ---------------------------------------------------------------------------
  73.